package rocketship;

import scaffold.Vertex;

/**
 *
 * @author Mikael Köhlmyr | mikael@kohlmyr.com | http://www.kmyr.net
 */
public class Geom {

        public static double dist(Vertex p, Vertex q) {
                return Math.sqrt((p.getX() - q.getX()) * (p.getX() - q.getX()) + (p.getY() - q.getY()) * (p.getY() - q.getY()) + (p.getZ() - q.getZ()) * (p.getZ() - q.getZ()));
        }

        public static Vertex get_random_pivoted_vertex2D(int max) {
                return new Vertex(Numeric.get_random_pivoted_double(max), Numeric.get_random_pivoted_double(max));
        }

        public static Vertex get_random_pivoted_vertex3D(int max) {
                return new Vertex(Numeric.get_random_pivoted_double(max), Numeric.get_random_pivoted_double(max), Numeric.get_random_pivoted_double(max));
        }

        public static Vertex get_random_buffered_vertex2D_in_bounds(int width, int height, int buffer) {
                return new Vertex((Math.random() * (width - (buffer * 2))) + buffer, (Math.random() * (height - (buffer * 2))) + buffer);
        }

        public static Vertex get_random_buffered_vertex3D_in_bounds(int width, int height, int depth, int buffer) {
                return new Vertex((Math.random() * (width - (buffer * 2))) + buffer, (Math.random() * (height - (buffer * 2))) + buffer, (Math.random() * (depth - (buffer * 2))) + buffer);
        }
}
